package memleak.test.com.testlist;


import android.support.annotation.NonNull;


import java.io.Serializable;

/**
 * Created by kelly on 2017/6/15.
 */

public class LiveChannel implements Serializable, Comparable{


    private static final long serialVersionUID = 4458948641128426804L;

    private String videoId;  //视频id
    private String cName;  //频道名
    private String cLogoUrl; //频道logourl
    private String caps; //频道类型 LIVE TSTV
    private String cNo; //频道号
    private String category; //属于的频道分类
    private String c_play_url;//直播地址
    private String instance_id; //马赛克使用
    private String template_id;
    private transient long totalDuration;  //该频道观看时长(喜爱分类)
    private transient int c_ts_limit_min;  //时移单位最小值
    private transient int c_ts_limit_default;
    private transient int c_ts_limit_max;
    private String cBackgroundUrl;

    /**
     * 类型
     * <p>
     * 1：直播频道
     * 2：回看频道
     * 3：互动栏目
     * 4：增值业务
     * 5：安卓应用
     * 6: 自定义
     */
    private String appType;

    /**
     * dvb数据结构
     */
    private DvbBean dvbBean;

    /**
     * 当前节目
     */
    private ProgramUnit presentProgram;

    /**
     * 下一个节目
     */
    private ProgramUnit followingProgram;

    public LiveChannel() {

    }

    public LiveChannel(String videoId, String cName, String cLogoUrl, String caps, String cNo, String category, String c_play_url, String instance_id, String template_id) {
        this.videoId = videoId;
        this.cName = cName;
        this.cLogoUrl = cLogoUrl;
        this.caps = caps;
        this.cNo = cNo;
        this.category = category;
        this.c_play_url = c_play_url;
        this.instance_id = instance_id;
        this.template_id = template_id;
    }

    public LiveChannel(String videoId, String cName, String cNo) {
        this.videoId = videoId;
        this.cName = cName;
        this.cNo = cNo;
    }

    public LiveChannel(String videoId, String cName, String cNo, String cLogoUrl) {
        this.videoId = videoId;
        this.cName = cName;
        this.cNo = cNo;
        this.cLogoUrl = cLogoUrl;
    }

    public int getC_ts_limit_min() {
        return c_ts_limit_min;
    }

    public void setC_ts_limit_min(int c_ts_limit_min) {
        this.c_ts_limit_min = c_ts_limit_min;
    }

    public int getC_ts_limit_default() {
        return c_ts_limit_default;
    }

    public void setC_ts_limit_default(int c_ts_limit_default) {
        this.c_ts_limit_default = c_ts_limit_default;
    }

    public int getC_ts_limit_max() {
        return c_ts_limit_max;
    }

    public void setC_ts_limit_max(int c_ts_limit_max) {
        this.c_ts_limit_max = c_ts_limit_max;
    }

    public String getVideoId() {
        return videoId;
    }

    public void setVideoId(String videoId) {
        this.videoId = videoId;
    }

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public String getcLogoUrl() {
        return cLogoUrl;
    }

    public void setcLogoUrl(String cLogoUrl) {
        this.cLogoUrl = cLogoUrl;
    }

    public String getCaps() {
        return caps;
    }

    public void setCaps(String caps) {
        this.caps = caps;
    }

    public String getcNo() {
        return cNo;
    }

    public void setcNo(String cNo) {
        this.cNo = cNo;
    }

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public String getC_play_url() {
        return c_play_url;
    }

    public void setC_play_url(String c_play_url) {
        this.c_play_url = c_play_url;
    }


    public String getInstance_id() {
        return instance_id;
    }

    public void setInstance_id(String instance_id) {
        this.instance_id = instance_id;
    }

    public String getTemplate_id() {
        return template_id;
    }

    public void setTemplate_id(String template_id) {
        this.template_id = template_id;
    }

    public String getAppType() {
        return appType;
    }

    public void setAppType(String appType) {
        this.appType = appType;
    }

    public DvbBean getDvbBean() {
        return dvbBean;
    }

    public void setDvbBean(DvbBean dvbBean) {
        this.dvbBean = dvbBean;
    }

    public ProgramUnit getPresentProgram() {
        return presentProgram;
    }

    public void setPresentProgram(ProgramUnit presentProgram) {
        this.presentProgram = presentProgram;
    }

    public ProgramUnit getFollowingProgram() {
        return followingProgram;
    }

    public void setFollowingProgram(ProgramUnit followingProgram) {
        this.followingProgram = followingProgram;
    }

    public long getTotalDuration() {
        return totalDuration;
    }

    public void setTotalDuration(long totalDuration) {
        this.totalDuration = totalDuration;
    }

    public String getBackgroundUrl() {
        return cBackgroundUrl;
    }

    public void setBackgroundUrl(String cBackgroundUrl) {
        this.cBackgroundUrl = cBackgroundUrl;
    }

    @Override
    public String toString() {
        return "LiveChannel{" +
                "videoId='" + videoId + '\'' +
                ", cName='" + cName + '\'' +
                ", cLogoUrl='" + cLogoUrl + '\'' +
                ", caps='" + caps + '\'' +
                ", cNo='" + cNo + '\'' +
                ", category='" + category + '\'' +
                ", c_play_url='" + c_play_url + '\'' +
                '}';
    }

    /**
     * * 这里表示按播放时间从小到大排序，如果该对象小于、等于或大于指定对象Object o，则分别返回负整数、零或正整数
     * 如果需要从大到小排序，则如果该对象小于、等于或大于指定对象Object o，则分别返回正整数、零或负整数
     *
     * @param o
     * @return
     */

    @Override
    public int compareTo(@NonNull Object o) {

        LiveChannel channel = (LiveChannel) o;

        if (this.getTotalDuration() < channel.getTotalDuration()) {
            return 1;
        }

        if (this.getTotalDuration() > channel.getTotalDuration()) {
            return -1;
        }
        return 0;
    }
}
